import React, { FC, useReducer, useState } from "react"

type StateType = { count: number }
type ActionType = { action: string }

const initialState: StateType = { count: 100 }

function reducer(){
    siwtch
}

// 根据传入的action返回新的state（不可变数据）

const CountReducer: FC = () => {
  //   const [count, setCount] = useState(100)
  //   dispatch是用于修改数据的派发函数

  return (
    <>
      <span>count:{state.count}</span>
      {/* <button onClick={() => setCount(count + 1)}>+</button>
      <button onClick={() => setCount(count - 1)}>-</button> */}
    </>
  )
}

export default CountReducer
